/******************************************************************************
 * SAGE - Scalable Adaptive Graphics Environment
 *
 * Module: streamInfo.h
 * Author : Byungil Jeong
 *
 * Copyright (C) 2004 Electronic Visualization Laboratory,
 * University of Illinois at Chicago
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either Version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser Public License along
 * with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Direct questions, comments etc about SAGE to bijeong@evl.uic.edu or 
 * http://www.evl.uic.edu/cavern/forum/
 *
 *****************************************************************************/

#ifndef _STREAM_INFO_H
#define _STREAM_INFO_H

#include "sageBase.h"

class streamInfo : public sageRect {
public:
	sageRect imgCoord;	
	int receiverId;  // Display Node ID
	int tileID; // virtual desktop tile ID
		
	streamInfo() : receiverId(0), tileID(0) {}
	~streamInfo() {}

	void printImageInfo();
	int generateInitBlock(sageBlock &block, int margin);	
};	

class streamGroup : public sageRect {
private:	
	std::vector<streamInfo> streamList;
	std::vector<streamInfo> finalStreams;

public:
	streamGroup();
	~streamGroup() {}
	void init();
	streamGroup& operator=(const sageRect& rect) { *(sageRect *)this = rect; }

	streamInfo* getStream(int i) { return &streamList[i]; }
	streamInfo* getFinalStream(int i) { return &finalStreams[i]; }
	std::vector<streamInfo> getStreamList() { return streamList; }
	int preStreamNum() { return streamList.size(); }
	int finalStreamNum() { return finalStreams.size(); }
	
	int addStream(streamInfo &s);
	//int normalizeStreams(sageRect &rect);
	int generateFinalStreams(sageRect &imgMap);
	
	void createMessage(sageMessage &msg, int code);
	void parseMessage(char *str);
};

#endif
